<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<title>登录</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.css" rel="stylesheet" />
		<link href="../css/style.css?100" rel="stylesheet" />
		<script src="../js/flexible.js"></script>
		<script src="../js/flexible_css.js"></script>
		<script src="../js/axios-proxy.js"></script>
		<script src="../conf.js"></script>
		<script src="../js/api.js"></script>
		<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
	</head>
	<style>body{background-color: #fcfcfc;}</style>
	<body>
		<div class="login" id="app">
			<div class="login-from">
				<div class="login-head">
					<div class="login-content">
						<h6>登录{{codemsg}}</h6>
						<div class="login-inpts">
							<input type="text" v-model="userInfo.username" placeholder="用户名">
							<input type="password" v-model="userInfo.password" placeholder="密码">
							<a class="login-inpts-forget" href="">忘记密码?</a>
						</div>
					</div>
				</div>
			</div>
			<div class="login-btns"><button @click="login">登录</button></div>
			<div class="login-foot">
				<!-- <div class="login-foot-btns"><button class="icon-wx">微信</button><button class="icon-wb">微博</button><button class="icon-qq">QQ</button> -->
				<div class="login-foot-msg" id="custom-nav">没有账号？ <a href="register.html">马上注册</a></div>
			</div>
		</div>
		</div>
		<script src="../js/mui.js"></script>
		<script type="text/javascript">
			mui.init();
			mui('#custom-nav').on('tap', 'a', function() {
				var href = this.getAttribute('href');
				openwind(href);
			});
			let vm = new Vue({
				el: "#app",
				data: {
					userInfo: {
						username: "",
						password: "",
					},
					codemsg: ''
				},
				methods: {
					login: function() {
						login(this.userInfo, function(res) {
							// vm.codemsg = res.result;
							if (res.result === 1) {
								localStorage.setItem('loginstate', true)
								localStorage.setItem('phone', vm.userInfo.username)
								plus.nativeUI.toast("登录成功~");
								openwind('../index.html');
							} else {
								plus.nativeUI.toast("登录失败~");
							}
						})
					}
				}
			});
		</script>
	</body>
</html>
